﻿using System;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Logging;

namespace netCoreStudy.Attr
{
	/// <summary>
	/// 检查资源是否为空
	/// </summary>
	public class CheckNullAttribute : ActionFilterAttribute
	{
		private readonly ILogger<CheckNullAttribute> _logger;

		public CheckNullAttribute(ILogger<CheckNullAttribute> logger)
		{
			_logger = logger;
		}


		public override void OnActionExecuting(ActionExecutingContext context)
		{
			ActionDescriptor descriptor = context.ActionDescriptor;
			_logger.LogInformation("这是action前");
		}
	}
}